using MicroMsg.Common.Algorithm;
using MicroMsg.Common.Utils;
using MicroMsg.Storage;
using MicroMsg.UI.Page;
using System;
using System.Collections.Generic;
namespace MicroMsg.Manager
{
	public class EmojiManager
	{
		public const int EMOJI_COUNT = 471;
		public const int RANGE_ONE_START = 57345;
		public const int RANGE_ONE_END = 57434;
		public const int RANGE_TWO_START = 57601;
		public const int RANGE_TWO_END = 57690;
		public const int RANGE_THREE_START = 57857;
		public const int RANGE_THREE_END = 57939;
		public const int RANGE_FOUR_START = 58113;
		public const int RANGE_FOUR_END = 58189;
		public const int RANGE_FIVE_START = 58369;
		public const int RANGE_FIVE_END = 58444;
		public const int RANGE_SIX_START = 58625;
		public const int RANGE_SIX_END = 58679;
		public const int ONE_RANGE_SIZE = 90;
		public const int TWO_RANGE_SIZE = 180;
		public const int THREE_RANGE_SIZE = 263;
		public const int FOUR_RANGE_SIZE = 340;
		public const int FIVE_RANGE_SIZE = 416;
		public const int DEFAULT_SIZE_IN_TITLE = -1;
		public const int DEFAULT_SIZE_IN_SUMMARY = -2;
		private const string TAG = "EmojiManager";
		private int[] codes;
		private List<string> codes_utf16;
		private string[] namesCh;
		private string[] namesTw;
		private string[] namesEn;
		private int[] files;
		private int maxEmojiTxtLen;
		private Dictionary<string, int> textsDic = new Dictionary<string, int>();
		private Dictionary<int, int> codesDic = new Dictionary<int, int>();
		private Dictionary<int, int> filesDic = new Dictionary<int, int>();
		private static EmojiManager emojiManager_0;
		private static int maxFavEmojiOrder = -1;
		public static void init()
		{
			if (!AccountMgr.isLogin || !StorageMgr.emojiArtGroup.IsEmpty())
			{
				return;
			}
			EmojiArtConst emojiArtConst = EmojiArtConstStorage.load();
			if (emojiArtConst == null)
			{
				return;
			}
			Log.smethod_5("EmojiManager", "add emoji cont res begin ");
			using (List<EmojiArtConstGroup>.Enumerator enumerator = emojiArtConst.list_0.GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					EmojiArtConstGroup current = enumerator.get_Current();
					StorageMgr.emojiArtGroup.method_3(new EmojiArtGroup(current));
					using (List<EmojiArtConstItem>.Enumerator enumerator2 = current.items.GetEnumerator())
					{
						while (enumerator2.MoveNext())
						{
							EmojiArtConstItem current2 = enumerator2.get_Current();
							StorageMgr.emojiArt.method_3(new EmojiArt(current2, current.nPackID));
						}
					}
				}
			}
			Log.smethod_5("EmojiManager", "add emoji cont res end ");
		}
		private EmojiManager()
		{
			this.codes = new int[]
			{
				58369,
				58370,
				58371,
				58372,
				58373,
				57607,
				58375,
				58391,
				58377,
				58378,
				58379,
				58380,
				58381,
				58382,
				58383,
				58384,
				58385,
				57605,
				58392,
				58390,
				57676,
				57357,
				57358,
				57359,
				58399,
				57361,
				58401,
				58397,
				58400,
				57904,
				57905,
				57902,
				57903,
				58393,
				58394,
				58396,
				58395,
				58174,
				58175,
				58176,
				58178,
				58431,
				58180,
				58187,
				58169,
				57632,
				57671,
				58171,
				57415,
				58124,
				57412,
				57413,
				58181,
				58182,
				58183,
				58184,
				58127,
				58126,
				57395,
				57394,
				58130,
				58119,
				58423,
				58132,
				58128,
				58433,
				57396,
				58129,
				57614,
				58149,
				58158,
				58160,
				58161,
				57629,
				57649,
				57647,
				57660,
				57661,
				58678,
				57434,
				57659,
				57635,
				57601,
				57407,
				57668,
				57373,
				58421,
				57371,
				57653,
				57654,
				57652,
				57613,
				57689,
				57372,
				57349,
				57348,
				57346,
				57345,
				57609,
				57610,
				57611,
				57612,
				58659,
				58663,
				58667,
				58670,
				58673,
				57627,
				57628,
				58661,
				58658,
				57426,
				57424,
				57422,
				57429,
				57428,
				57427,
				58136,
				58137,
				58140,
				57662,
				58139,
				58428,
				58147,
				58146,
				57350,
				57351,
				57417,
				57418,
				57419,
				57420,
				57416,
				58162,
				58163,
				58166,
				58167,
				57353,
				57352,
				57354,
				57355,
				57356,
				57405,
				57404,
				57619,
				57638,
				58151,
				57871,
				57645,
				57644,
				57651,
				57678,
				57655,
				57409,
				58144,
				57663,
				57664,
				57398,
				57399,
				57677,
				57685,
				57688,
				57684,
				57686,
				57656,
				57657
			};
			List<string> list = new List<string>();
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude25'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude0f'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude14'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude01'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude09'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude31'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude16'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude1a'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude1d'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude0c'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude28'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude37'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude33'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude12'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude30'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude32'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude2d'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude1c'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude18'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude21'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udcaa'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc4a'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc4d'
			}));
			list.Add(new string(new char[]
			{
				'☝'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc4f'
			}));
			list.Add(new string(new char[]
			{
				'✌'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc4e'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude4f'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc4c'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc48'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc49'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc46'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc47'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc40'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc43'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc44'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc42'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf5a'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf5d'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf5c'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf59'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf67'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf63'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf82'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf5e'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf54'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf73'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf5f'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf7a'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf7b'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf78'
			}));
			list.Add(new string(new char[]
			{
				'☕'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf4e'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf4a'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf53'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf49'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc8a'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udeac'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf84'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf39'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf89'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf34'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc9d'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf80'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf88'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc1a'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc8d'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udca3'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc51'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udd14'
			}));
			list.Add(new string(new char[]
			{
				'✨'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udca8'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udca6'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udd25'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udfc6'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udcb0'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udca4'
			}));
			list.Add(new string(new char[]
			{
				'⚡'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc63'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udca9'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc89'
			}));
			list.Add(new string(new char[]
			{
				'♨'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udceb'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udd11'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udd12'
			}));
			list.Add(new string(new char[]
			{
				'✈'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude84'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude97'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udea4'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udeb2'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc0e'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude80'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\ude8c'
			}));
			list.Add(new string(new char[]
			{
				'⛵'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc69'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc68'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc67'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc66'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc35'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc19'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc37'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc7d'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc24'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc28'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc2e'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc14'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc38'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc7b'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc80'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc1b'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc20'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc36'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc2f'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc7c'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc27'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc33'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc2d'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc52'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc57'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc84'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc60'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc62'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf02'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc5c'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc59'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc55'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc5f'
			}));
			list.Add(new string(new char[]
			{
				'☁'
			}));
			list.Add(new string(new char[]
			{
				'☀'
			}));
			list.Add(new string(new char[]
			{
				'☔'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udf19'
			}));
			list.Add(new string(new char[]
			{
				'⛄'
			}));
			list.Add(new string(new char[]
			{
				'⭕'
			}));
			list.Add(new string(new char[]
			{
				'❌'
			}));
			list.Add(new string(new char[]
			{
				'❔'
			}));
			list.Add(new string(new char[]
			{
				'❕'
			}));
			list.Add(new string(new char[]
			{
				'☎'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udcf7'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udcf1'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udce0'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udcbb'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udfa5'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udfa4'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udd2b'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udcbf'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc93'
			}));
			list.Add(new string(new char[]
			{
				'♣'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udc04'
			}));
			list.Add(new string(new char[]
			{
				'〽'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udfb0'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udea5'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udea7'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udfb8'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udc88'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udec0'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udebd'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udfe0'
			}));
			list.Add(new string(new char[]
			{
				'⛪'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udfe6'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udfe5'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udfe8'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udfe7'
			}));
			list.Add(new string(new char[]
			{
				'\ud83c',
				'\udfea'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udeb9'
			}));
			list.Add(new string(new char[]
			{
				'\ud83d',
				'\udeba'
			}));
			this.codes_utf16 = list;
			this.namesCh = new string[]
			{
				"汗",
				"假笑",
				"哼",
				"咧嘴",
				"玩笑",
				"呐喊",
				"难受",
				"亲亲",
				"调皮",
				"放松",
				"衰",
				"口罩",
				"吓",
				"没劲",
				"惊恐",
				"茫然",
				"大哭",
				"眨眼",
				"飞吻",
				"发怒",
				"肌肉",
				"拳头",
				"强",
				"不",
				"鼓掌",
				"剪刀手",
				"弱",
				"膜拜",
				"OK",
				"左",
				"右",
				"上",
				"下",
				"眼睛",
				"鼻子",
				"嘴唇",
				"耳朵",
				"饭",
				"意大利面",
				"面条",
				"饭团",
				"冰淇淋",
				"寿司",
				"蛋糕",
				"面包",
				"汉堡",
				"煎蛋",
				"薯条",
				"啤酒",
				"干杯",
				"高脚杯",
				"茶",
				"苹果",
				"橙子",
				"草莓",
				"西瓜",
				"药丸",
				"吸烟",
				"圣诞树",
				"玫瑰",
				"礼花",
				"椰树",
				"礼物",
				"蝴蝶结",
				"气球",
				"贝壳",
				"指环",
				"炸弹",
				"皇冠",
				"钟",
				"闪烁",
				"跑远",
				"喷口水",
				"怒火",
				"奖杯",
				"钱",
				"困",
				"闪电",
				"脚印",
				"屎",
				"打针",
				"辣",
				"邮箱",
				"钥匙",
				"锁",
				"飞机",
				"火车",
				"轿车",
				"船",
				"自行车",
				"马",
				"火箭",
				"巴士",
				"帆船",
				"女人",
				"男人",
				"女孩",
				"男孩",
				"猴头",
				"章鱼",
				"猪头",
				"外星人",
				"鸭子",
				"熊",
				"奶牛",
				"公鸡",
				"青蛙",
				"鬼",
				"骷髅",
				"毛毛虫",
				"鱼",
				"狗",
				"猫",
				"天使",
				"小鸟",
				"鲸鱼",
				"老鼠",
				"帽子",
				"裙子",
				"唇膏",
				"高跟鞋",
				"靴子",
				"伞",
				"包",
				"比基尼",
				"衬衣",
				"皮鞋",
				"云",
				"太阳",
				"下雨",
				"月亮",
				"下雪",
				"圈",
				"叉",
				"问号",
				"叹号",
				"电话",
				"相机",
				"手机",
				"传真机",
				"屏幕",
				"摄影机",
				"卡拉OK",
				"枪",
				"光盘",
				"心",
				"扑克",
				"麻将",
				"股票",
				"老虎机",
				"交通灯",
				"路障",
				"吉他",
				"理发店",
				"洗澡",
				"马桶",
				"房子",
				"教堂",
				"银行",
				"医院",
				"酒店",
				"ATM",
				"便利店",
				"男性",
				"女性"
			};
			this.namesTw = new string[]
			{
				"汗",
				"假笑",
				"哼",
				"咧嘴",
				"玩笑",
				"吶喊",
				"難受",
				"親親",
				"調皮",
				"放鬆",
				"衰",
				"口罩",
				"嚇",
				"沒勁",
				"驚恐",
				"茫然",
				"大哭",
				"眨眼",
				"飛吻",
				"發怒",
				"肌肉",
				"拳頭",
				"強",
				"不",
				"鼓掌",
				"剪刀手",
				"弱",
				"膜拜",
				"OK",
				"左",
				"右",
				"上",
				"下",
				"眼睛",
				"鼻子",
				"嘴唇",
				"耳朵",
				"飯",
				"意大利面",
				"面條",
				"飯團",
				"冰淇淋",
				"壽司",
				"蛋糕",
				"面包",
				"漢堡",
				"煎蛋",
				"薯條",
				"啤酒",
				"幹杯",
				"高腳杯",
				"茶",
				"蘋果",
				"橙子",
				"草莓",
				"西瓜",
				"藥丸",
				"吸煙",
				"聖誕樹",
				"玫瑰",
				"禮花",
				"椰樹",
				"禮物",
				"蝴蝶結",
				"氣球",
				"貝殼",
				"指環",
				"炸彈",
				"皇冠",
				"鐘",
				"驚訝",
				"跑遠",
				"噴口水",
				"怒火",
				"獎杯",
				"錢",
				"困",
				"閃電",
				"腳印",
				"屎",
				"打針",
				"辣",
				"郵箱",
				"鑰匙",
				"鎖",
				"飛機",
				"火車",
				"轎車",
				"船",
				"自行車",
				"馬",
				"火箭",
				"巴士",
				"帆船",
				"女人",
				"男人",
				"女孩",
				"男孩",
				"猴頭",
				"章魚",
				"豬頭",
				"外星人",
				"鴨子",
				"熊",
				"奶牛",
				"公雞",
				"青蛙",
				"鬼",
				"骷髏",
				"毛毛蟲",
				"魚",
				"狗",
				"貓",
				"天使",
				"小鳥",
				"鯨魚",
				"老鼠",
				"帽子",
				"裙子",
				"唇膏",
				"高跟鞋",
				"靴子",
				"傘",
				"包",
				"比基尼",
				"襯衣",
				"皮鞋",
				"雲",
				"太陽",
				"下雨",
				"月亮",
				"下雪",
				"圈",
				"叉",
				"問號",
				"嘆號",
				"電話",
				"相機",
				"手機",
				"傳真機",
				"屏幕",
				"攝影機",
				"卡拉OK",
				"槍",
				"光盤",
				"心",
				"撲克",
				"麻將",
				"股票",
				"老虎機",
				"交通燈",
				"路障",
				"吉他",
				"理發店",
				"洗澡",
				"馬桶",
				"房子",
				"教堂",
				"銀行",
				"醫院",
				"酒店",
				"ATM",
				"便利店",
				"男性",
				"女性"
			};
			this.namesEn = new string[]
			{
				"Sweat",
				"Smirk",
				"Hmm",
				"Grin",
				"Wink",
				"Scream",
				"Sick",
				"Kiss",
				"Funny",
				"Relax",
				"Bad",
				"Mask",
				"Boggle",
				"Boring",
				"Panic",
				"Dizzy",
				"Cry",
				"Blink",
				"blowkiss",
				"pouting",
				"Muscle",
				"Fist",
				"Strong",
				"No",
				"Clap",
				"Yeah",
				"Weak",
				"Worship",
				"OK",
				"Left",
				"Right",
				"Up",
				"Down",
				"Eyes",
				"Nose",
				"Lip",
				"Ear",
				"Rice",
				"Pasta",
				"Noodle",
				"Onigiri",
				"Ice",
				"Sushi",
				"Cake",
				"Bread",
				"Burger",
				"Egg",
				"Fries",
				"Beer",
				"Cheers",
				"Goblet",
				"Coffee",
				"Apple",
				"Orange",
				"Berry",
				"Melon",
				"Pill",
				"Smoke",
				"Xmastree",
				"Rose",
				"Salute",
				"Palm",
				"Gift",
				"Bowtie",
				"Ballon",
				"Shell",
				"Ring",
				"Bomb",
				"Crown",
				"Bell",
				"Shine",
				"Scoot",
				"Spout",
				"Onfire",
				"Trophy",
				"Dollar",
				"Sleepy",
				"Thunder",
				"Pug",
				"Shit",
				"Inject",
				"Spicy",
				"Mailbox",
				"Key",
				"Lock",
				"Plane",
				"Train",
				"Car",
				"Boat",
				"Bike",
				"Horse",
				"Rocket",
				"Bus",
				"Yacht",
				"Women",
				"Man",
				"Girl",
				"Boy",
				"Monkey",
				"Octopus",
				"Pig",
				"Alien",
				"Duck",
				"Bear",
				"Cow",
				"Cock",
				"Frog",
				"Ghost",
				"Skull",
				"Worm",
				"Fish",
				"Dog",
				"Cat",
				"Angel",
				"Bird",
				"Whale",
				"Mouse",
				"Hat",
				"Dress",
				"Lippie",
				"Highheels",
				"Boots",
				"Parasol",
				"Bag",
				"Bikini",
				"T-shirt",
				"Shoes",
				"Cloud",
				"Sun",
				"Rain",
				"Moon",
				"Snow",
				"Circle",
				"Cross",
				"？",
				"！",
				"Phone",
				"Camera",
				"Mobile",
				"Fax",
				"Screen",
				"Camera",
				"Karaoke",
				"Gun",
				"Disk",
				"Heart",
				"Poker",
				"Mahjong",
				"Stock",
				"Slot",
				"Signal",
				"Block",
				"Guitar",
				"Barber",
				"Bath",
				"Toilet",
				"House",
				"Chruch",
				"Bank",
				"Hospital",
				"Hotel",
				"ATM",
				"Store",
				"Male",
				"Female"
			};
			this.files = new int[]
			{
				340,
				341,
				342,
				343,
				344,
				96,
				346,
				362,
				348,
				349,
				350,
				351,
				352,
				353,
				354,
				355,
				356,
				94,
				363,
				361,
				165,
				12,
				13,
				14,
				370,
				16,
				372,
				368,
				371,
				227,
				228,
				225,
				226,
				364,
				365,
				367,
				366,
				324,
				325,
				326,
				328,
				402,
				330,
				337,
				319,
				121,
				160,
				321,
				70,
				274,
				67,
				68,
				331,
				332,
				333,
				334,
				277,
				276,
				50,
				49,
				280,
				269,
				394,
				282,
				278,
				404,
				51,
				279,
				103,
				299,
				308,
				310,
				311,
				118,
				138,
				136,
				149,
				150,
				469,
				89,
				148,
				124,
				90,
				62,
				157,
				28,
				392,
				26,
				142,
				143,
				141,
				102,
				178,
				27,
				4,
				3,
				1,
				0,
				98,
				99,
				100,
				101,
				450,
				454,
				458,
				461,
				464,
				116,
				117,
				452,
				449,
				81,
				79,
				77,
				84,
				83,
				82,
				286,
				287,
				290,
				151,
				289,
				399,
				297,
				296,
				5,
				6,
				72,
				73,
				74,
				75,
				71,
				312,
				313,
				316,
				317,
				8,
				7,
				9,
				10,
				11,
				60,
				59,
				108,
				127,
				301,
				194,
				134,
				133,
				140,
				167,
				144,
				64,
				294,
				152,
				153,
				53,
				54,
				166,
				174,
				177,
				173,
				175,
				145,
				146
			};
			for (int i = 0; i < this.files.Length; i++)
			{
				this.filesDic.Add(this.files[i], i);
			}
			for (int j = 0; j < this.namesCh.Length; j++)
			{
				string text = "<" + this.namesCh[j] + ">";
				this.textsDic.Add(text, j);
				if (text.get_Length() > this.maxEmojiTxtLen)
				{
					this.maxEmojiTxtLen = text.get_Length();
				}
			}
			for (int k = 0; k < this.namesTw.Length; k++)
			{
				string text = "<" + this.namesTw[k] + ">";
				if (!this.textsDic.ContainsKey(text))
				{
					this.textsDic.Add(text, k);
					if (text.get_Length() > this.maxEmojiTxtLen)
					{
						this.maxEmojiTxtLen = text.get_Length();
					}
				}
			}
			for (int l = 0; l < this.namesEn.Length; l++)
			{
				string text = "<" + this.namesEn[l] + ">";
				if (!this.textsDic.ContainsKey(text))
				{
					this.textsDic.Add(text, l);
					if (text.get_Length() > this.maxEmojiTxtLen)
					{
						this.maxEmojiTxtLen = text.get_Length();
					}
				}
			}
			for (int m = 0; m < this.codes.Length; m++)
			{
				if (!this.codesDic.ContainsKey(this.codes[m]))
				{
					this.codesDic.Add(this.codes[m], m);
				}
			}
		}
		public int GetEmojiCount()
		{
			if (this.namesCh != null && this.namesCh.Length > 0)
			{
				return this.namesCh.Length;
			}
			return 0;
		}
		public int GetMaxEmojiTxtLen()
		{
			return this.maxEmojiTxtLen;
		}
		public string getEmojiSrc(int position)
		{
			if (position >= 0 && position < this.files.Length)
			{
				return "/MicroMsg;component/Resource/Img/emoji/" + this.files[position] + ".png";
			}
			return null;
		}
		public string getLoadEmojiSrc(int position)
		{
			if (position >= 0 && position < this.files.Length)
			{
				return "/MicroMsg;componentResource/Img/emoji/" + this.files[position] + ".png";
			}
			return null;
		}
		public string getEmojiCodeByText(string text)
		{
			if (this.textsDic.ContainsKey(text))
			{
				return string.Concat((char)this.codes[this.textsDic.get_Item(text)]);
			}
			return null;
		}
		public string getEmojiSrc(string text)
		{
			if (this.textsDic.ContainsKey(text))
			{
				return this.getEmojiSrc(this.textsDic.get_Item(text));
			}
			return null;
		}
		public string getEmojiSrcFromFilePos(int int_0)
		{
			return "/MicroMsg;component/Resource/Img/emoji/" + int_0 + ".png";
		}
		public string getEmojiSrcFromChatViewIndex(int index)
		{
			if (this.files != null && index < this.files.Length && index >= 0)
			{
				return this.getEmojiSrcFromFilePos(this.files[index]);
			}
			return "";
		}
		public int GetCodeByIndex(int index)
		{
			if (this.codes != null && index < this.codes.Length && index >= 0)
			{
				return this.codes[index];
			}
			return 58369;
		}
		public string GetUtf16CodeByIndex(int index)
		{
			if (this.codes_utf16 != null && index < this.codes_utf16.get_Count() && index >= 0)
			{
				return this.codes_utf16.get_Item(index);
			}
			return "";
		}
		public static EmojiManager GetInstance()
		{
			if (EmojiManager.emojiManager_0 == null)
			{
				EmojiManager.emojiManager_0 = new EmojiManager();
				EmojiManager.init();
			}
			return EmojiManager.emojiManager_0;
		}
		public int getEmojiPos(char char_0)
		{
			if (char_0 >= '' && char_0 <= '')
			{
				return (int)(char_0 - '');
			}
			if (char_0 >= '' && char_0 <= '')
			{
				return (int)('Z' + char_0 - '');
			}
			if (char_0 >= '' && char_0 <= '')
			{
				return (int)('´' + char_0 - '');
			}
			if (char_0 >= '' && char_0 <= '')
			{
				return (int)('ć' + char_0 - '');
			}
			if (char_0 >= '' && char_0 <= '')
			{
				return (int)('Ŕ' + char_0 - '');
			}
			if (char_0 >= '' && char_0 <= '')
			{
				return (int)('Ơ' + char_0 - '');
			}
			return -1;
		}
		protected string GetCurrentElement(string text, int startIndex, ref int elementLen, ref string elementStr)
		{
			if (startIndex < 0)
			{
				return null;
			}
			for (int i = 1; i <= EmojiManager.GetInstance().GetMaxEmojiTxtLen() - 1; i++)
			{
				if (text.get_Length() > startIndex + i)
				{
					string text2 = text.Substring(startIndex, i + 1);
					string emojiCodeByText = EmojiManager.GetInstance().getEmojiCodeByText(text2);
					if (emojiCodeByText != null)
					{
						elementLen = i + 1;
						elementStr = text2;
						return emojiCodeByText;
					}
				}
			}
			elementLen = 0;
			elementStr = null;
			return null;
		}
		protected int GetProbablyStartPos(string text, int startIndex)
		{
			if (string.IsNullOrEmpty(text))
			{
				return -1;
			}
			return text.IndexOf("<", startIndex);
		}
		protected List<string> DivisionText(string text, ref bool isHasEmoji)
		{
			if (string.IsNullOrEmpty(text))
			{
				return null;
			}
			List<string> list = new List<string>();
			int num = this.GetProbablyStartPos(text, 0);
			while (num >= 0 && num < text.get_Length())
			{
				int num2 = 0;
				string text2 = "";
				string currentElement = this.GetCurrentElement(text, num, ref num2, ref text2);
				if (currentElement == null)
				{
					num++;
					num = this.GetProbablyStartPos(text, num);
				}
				else
				{
					isHasEmoji = true;
					if (num == 0)
					{
						list.Add(currentElement);
					}
					else
					{
						string text3 = text.Substring(0, num);
						list.Add(text3);
						list.Add(currentElement);
					}
					text = text.Substring(num + num2, text.get_Length() - num - num2);
					num = 0;
				}
			}
			if (!string.IsNullOrEmpty(text))
			{
				list.Add(text);
			}
			return list;
		}
		public string ConvertInputStrToCodeStr(string inputStr, ref bool isHasEmoji)
		{
			isHasEmoji = false;
			if (string.IsNullOrEmpty(inputStr))
			{
				return "";
			}
			List<string> list = this.DivisionText(inputStr, ref isHasEmoji);
			if (list != null && list.get_Count() > 0)
			{
				string text = "";
				for (int i = 0; i < list.get_Count(); i++)
				{
					text += list.get_Item(i);
				}
				return text;
			}
			return "";
		}
		public string SbCodeToUtf16Code(string sbStr, ref bool isHasEmoji)
		{
			isHasEmoji = false;
			if (string.IsNullOrEmpty(sbStr))
			{
				return "";
			}
			string text = "";
			for (int i = 0; i < sbStr.get_Length(); i++)
			{
				string text2 = new string(sbStr.ToCharArray(), i, 1);
				if (this.codes_utf16.Contains(text2))
				{
					int num = this.codes_utf16.IndexOf(text2);
					text += (char)this.codes[num];
					isHasEmoji = true;
				}
				else
				{
					if (i < sbStr.get_Length() - 1)
					{
						string text3 = new string(sbStr.ToCharArray(), i, 2);
						if (this.codes_utf16.Contains(text3))
						{
							int num2 = this.codes_utf16.IndexOf(text3);
							text += (char)this.codes[num2];
							isHasEmoji = true;
							i++;
							goto IL_C3;
						}
					}
					text += text2;
				}
				IL_C3:;
			}
			return text;
		}
		public string GetCodeStrNameByLanguage(int index)
		{
			if (index < 0 || index > this.namesCh.Length)
			{
				return "";
			}
			if (R.isChineseCN())
			{
				return this.namesCh[index];
			}
			if (R.isChineseTW())
			{
				return this.namesTw[index];
			}
			return this.namesEn[index];
		}
		public bool IsEmojiMsg(ChatMsg chatMsg_0)
		{
			if (chatMsg_0 == null)
			{
				return false;
			}
			if (!chatMsg_0.IsTxt())
			{
				return false;
			}
			string text = "";
			string codeStr = "";
			return ChatMsgMgr.getMsgUser(chatMsg_0, ref text, ref codeStr) && this.IsHasEmojiCode(codeStr);
		}
		public bool IsHasEmojiCode(string codeStr)
		{
			if (string.IsNullOrEmpty(codeStr))
			{
				return false;
			}
			for (int i = 0; i < codeStr.get_Length(); i++)
			{
				int emojiPos = EmojiManager.GetInstance().getEmojiPos(codeStr.get_Chars(i));
				if (emojiPos != -1)
				{
					return true;
				}
			}
			return false;
		}
		public string getUtf16CodeString(string codeStr)
		{
			if (string.IsNullOrEmpty(codeStr))
			{
				return "";
			}
			bool flag = false;
			int num = 0;
			while (!flag)
			{
				int emojiPos = EmojiManager.GetInstance().getEmojiPos(codeStr.get_Chars(num));
				if (emojiPos < 0)
				{
					num++;
				}
				else
				{
					if (this.filesDic.ContainsKey(emojiPos))
					{
						int num2 = this.filesDic.get_Item(emojiPos);
						string text = this.codes_utf16.get_Item(num2);
						codeStr = this.ReplaceStr(codeStr, num, 1, text);
						num += text.get_Length();
					}
					else
					{
						num++;
					}
				}
				if (num >= codeStr.get_Length())
				{
					flag = true;
				}
			}
			return codeStr;
		}
		public string ConvertCodeStrToInputStr(string codeStr)
		{
			if (string.IsNullOrEmpty(codeStr))
			{
				return "";
			}
			bool flag = false;
			int num = 0;
			while (!flag)
			{
				int emojiPos = EmojiManager.GetInstance().getEmojiPos(codeStr.get_Chars(num));
				if (emojiPos < 0)
				{
					num++;
				}
				else
				{
					if (this.filesDic.ContainsKey(emojiPos))
					{
						int index = this.filesDic.get_Item(emojiPos);
						string codeStrNameByLanguage = this.GetCodeStrNameByLanguage(index);
						codeStr = this.ReplaceStr(codeStr, num, 1, "<" + codeStrNameByLanguage + ">");
						num += codeStrNameByLanguage.get_Length() + 2;
					}
					else
					{
						num++;
					}
				}
				if (num >= codeStr.get_Length())
				{
					flag = true;
				}
			}
			return codeStr;
		}
		public string ReplaceStr(string inputStr, int start, int int_0, string extStr)
		{
			if (string.IsNullOrEmpty(inputStr))
			{
				return "";
			}
			if (start < 0 || start >= inputStr.get_Length())
			{
				return inputStr;
			}
			if (start + int_0 - 1 >= inputStr.get_Length())
			{
				return inputStr;
			}
			string text = "";
			if (start > 0)
			{
				text = inputStr.Substring(0, start);
			}
			string text2 = "";
			if (start + int_0 < inputStr.get_Length())
			{
				text2 = inputStr.Substring(start + int_0, inputStr.get_Length() - start - int_0);
			}
			return text + extStr + text2;
		}
		public static int EmojiComparison(EmojiArt emo1, EmojiArt emo2)
		{
			if (emo1 != null && emo2 != null)
			{
				return emo2.nOrder - emo1.nOrder;
			}
			return 0;
		}
		public static List<EmojiArt> getList(int nPackID, bool beSort = true)
		{
			List<EmojiArt> listByPackID = StorageMgr.emojiArt.getListByPackID(nPackID);
			if (listByPackID == null)
			{
				return null;
			}
			if (beSort)
			{
				listByPackID.Sort(new Comparison<EmojiArt>(EmojiManager.EmojiComparison));
			}
			return listByPackID;
		}
		private void initFavEmojiOrder()
		{
			if (EmojiManager.maxFavEmojiOrder >= 0)
			{
				return;
			}
			EmojiManager.maxFavEmojiOrder = 0;
			List<EmojiArt> listByPackID = StorageMgr.emojiArt.getListByPackID(1);
			if (listByPackID == null)
			{
				return;
			}
			using (List<EmojiArt>.Enumerator enumerator = listByPackID.GetEnumerator())
			{
				while (enumerator.MoveNext())
				{
					EmojiArt current = enumerator.get_Current();
					int arg_37_0 = current.nOrder;
					if (current.nOrder > EmojiManager.maxFavEmojiOrder)
					{
						EmojiManager.maxFavEmojiOrder = current.nOrder;
					}
				}
			}
		}
		public void SaveEmojiToFav(string content)
		{
			if (string.IsNullOrEmpty(content))
			{
				return;
			}
			content = content.Replace('\n', '\r');
			string text = MD5Core.GetHashString(content) + "1";
			EmojiArt emojiArt = StorageMgr.emojiArt.method_1(text);
			if (emojiArt != null)
			{
				Log.smethod_1("EmojiManager", "StorageMgr.emojiArt.add already has this art emoji");
				return;
			}
			this.initFavEmojiOrder();
			EmojiArt emojiArt2 = new EmojiArt();
			emojiArt2.nPackID = 1;
			emojiArt2.strEmojiArt = content;
			emojiArt2.strMD5 = text;
			emojiArt2.nOrder = ++EmojiManager.maxFavEmojiOrder;
			StorageMgr.emojiArt.method_3(emojiArt2);
		}
	}
}
